/**
 * Keyboard driver
 * Copyright (c) 2013 Maris BECS. All rights reserved.
 */

#ifndef KEYBOARD_H_INCLUDED
#define KEYBOARD_H_INCLUDED

#include "gpio.h"

//! Keyboard definitions from conf_menu.h
#define KEYBOARD_NO_KEY 0

#define KEYBOARD_ENTER 13    // ENTER
#define KEYBOARD_ENTER_MASK 1

#define KEYBOARD_UP 38       // UP
#define KEYBOARD_UP_MASK 2

#define KEYBOARD_DOWN 40     // DOWN
#define KEYBOARD_DOWN_MASK 4

#define KEYBOARD_BACK 8      // BACK
#define KEYBOARD_BACK_MASK 8


typedef uint8_t keycode_t;

//! Definition of the different keyboard event types
enum keyboard_event_type {
	KEYBOARD_NO_EVENT,
	KEYBOARD_PRESS,
	KEYBOARD_RELEASE,
};

//! Struct to hold a keycode and the related event
struct keyboard_event {
	keycode_t keycode;
	enum keyboard_event_type type;
};

void keyboard_get_key_state(struct keyboard_event *key);

#endif /* KEYBOARD_H_INCLUDED */
